<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-box.css">
    <script src="js/zy_control.js"></script>
    <script src="js/zy_click.js"></script>
    <script src="js/commonCity.js"></script>
    <script src="js/zy_json.js"></script>
    <script src="js/appcan.min.js"></script>
    <script src="js/zy_slide.js"></script>
    <script src="js/appcan.js"></script>
    <script src="js/appcan.control.js"></script>
    <script src="js/talkingData.js"></script>
    <style>
       .air{
          width: 94%;
          padding: 0 3%;
          height: 2.5em;
          line-height: 2.5em;
          border-bottom: solid #ededed 1px;
        }
    </style>
</head>
<body class="um-vp" ontouchstart>
      <div id="airportInfo" class="ub ub-ver">
          
      </div>
</body>
<script>
    zy_init();
    window.uexOnload=function(type){
    	if(!type){
    		 queryAllAirport();
    	}
    }
    
    /**
     *初始化查询所有的机场的三字码和中文名字(有数据加载提示)
     */
   function queryAllAirport(name){ 
        var sname = isDefine(name) ? name : ""; 
        var param =[{'key':'key','type':'0','value':sname }];
        var dataUrl = yddfProUrl+"system_searchAirports.action";
        uexWindow.toast(0, 5, '正在加载数据，请稍后...', -1);
        $.getJSON(dataUrl, function(data){
            var tempHtml = "";
            if(data.length > 0){
                var tempHtml1 = "",starHtml1 = '<div class="ub ub-ac air" style="background: #f4f4f4;font-size: 1.2em;font-weight: bold;">重要航站</div>'; 
                var tempHtml2 = "",starHtml2 = '<div class="ub ub-ac air" style="background: #f4f4f4;font-size: 1.2em;font-weight: bold;">一般航站</div>';
                for(var i = 0;i < data.length;i++){
                    var enname = data[i].enname,
                        chname = data[i].chname;
                    if(isDefine(data[i].priority) && data[i].priority != "2"){
                        tempHtml1 += '<div id="list'+i+'" class="ub ub-ac air" onclick="setAirport(\''+chname+'\',\''+enname+'\',\'list'+i+'\')">'+chname+'('+enname+')</div>';
                    }else{
                        tempHtml2 += '<div id="list'+i+'" class="ub ub-ac air" onclick="setAirport(\''+chname+'\',\''+enname+'\',\'list'+i+'\')">'+chname+'('+enname+')</div>';
                    }
                }
                $$("airportInfo").innerHTML = starHtml1+tempHtml1+starHtml2+tempHtml2;
                uexWindow.closeToast();
            }else{
                $$("airportInfo").innerHTML = '<div>没有相关数据</div>';
                uexWindow.closeToast();
            }

        }, "json",function(err){
              alert("暂无数据！");
        },"POST",param,false);
    }
    

    


   function searchAllAirport(name){ 
        var sname = isDefine(name) ? name : ""; 
        var param =[{'key':'key','type':'0','value':sname }];
        var dataUrl = yddfProUrl+"system_searchAirports.action";
        console.log(dataUrl);
        $.getJSON(dataUrl, function(data){
            var tempHtml = "";
            if(data.length > 0){
                var tempHtml1 = "",starHtml1 = '<div class="ub ub-ac air" style="background: #f4f4f4;font-size: 1.2em;font-weight: bold;">重要航站</div>'; 
                var tempHtml2 = "",starHtml2 = '<div class="ub ub-ac air" style="background: #f4f4f4;font-size: 1.2em;font-weight: bold;">一般航站</div>';
                for(var i = 0;i < data.length;i++){
                    var enname = data[i].enname,
                        chname = data[i].chname;
                    if(isDefine(data[i].priority) && data[i].priority != "2"){
                        tempHtml1 += '<div id="list'+i+'" style="background-color: white;" class="ub ub-ac air" onclick="setAirport(\''+chname+'\',\''+enname+'\',\'list'+i+'\')">'+chname+'('+enname+')</div>';
                    }else{
                        tempHtml2 += '<div id="list'+i+'" style="background-color: white;" class="ub ub-ac air" onclick="setAirport(\''+chname+'\',\''+enname+'\',\'list'+i+'\')">'+chname+'('+enname+')</div>';
                    }

                }
                $$("airportInfo").innerHTML = starHtml1+tempHtml1+starHtml2+tempHtml2;
            }else{
                $$("airportInfo").innerHTML = '<div>没有相关数据</div>';
            }

        }, "json",function(err){
              alert("暂无数据！");
        },"POST",param,false);
    } 
    
 
    /**
     *设置航站名称和三字码 
     */
    function setAirport(name,code,id){
       // talkingDataCount("选择航站","0009");
        $$(id).style.backgroundColor="#dcdcdc";
        setLocVal("airportName",name);
        setLocVal("airportCode",code);
        setLocVal("cityName",name);
        setLocVal("cityCode",code);

//     
          // appcan.frame.evaluateScript({
            // name:'today',
            // popName:'content',
            // scriptContent:"setAirPort('"+name+"','"+code+"')"
            // });
           uexWindow.evaluatePopoverScript("bjscPage", "content", "citySelect()");
            //appcan.window.evaluateScript("today","reload()");
            //uexWindow.evaluateMultiPopoverScript("ecos", "contents", "today", "reload()");
           // alert('ccccccccccccccc');
           /*appcan.window.evaluatePopoverScript({
                name:'today',
                popName:'today_content',
                scriptContent:"setAirPort('"+name+"','"+code+"')"
           });*/
           // alert('22222222222222');
           /* appcan.window.evaluatePopoverScript({
                name:'today',
                popName:'today_content',
                scriptContent:'reload()' 
           });*/
           uexWindow.publishChannelNotification('today_df','reload()');
            //uexWindow.evaluatePopoverScript("today","content","setAirPort('"+name+"','"+code+"')");
          // alert('ssssss');
        //uexWindow.evaluateMultiPopoverScript("today", "contents", "psManager", "setAirPort('"+name+"','"+code+"')");
        
       uexWindow.evaluateScript("airport_select", "0", "closeFatherWindow('"+name+"','"+code+"')");
        //alert('zou');
    }
</script>
</html>
